package tech.luoyu.ki.controller;

import java.util.HashMap;
import java.util.Map;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class IndexController {

	@RequestMapping(value = { "", "index" })
	public ModelAndView index() {
		Map<String, Object> model = new HashMap<String, Object>();

		Subject currentUser = SecurityUtils.getSubject();
		Session session = currentUser.getSession();
		System.out.println(session.getAttribute("user"));

		model.put("message", "Welcome!");
		return new ModelAndView("index", model);
	}
}
